package com.ss.android.image;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import com.ss.android.image.model.ImageInfo;

import java.io.Serializable;
import java.util.List;

public class Image implements Parcelable, Serializable {
    public static final Parcelable.Creator CREATOR = new k();
    public static final int TYPE_BMP = 3;
    public static final int TYPE_DEFAULT = 0;
    public static final int TYPE_GIF = 2;
    public static final int TYPE_JPEG = 1;
    public static final int TYPE_PNG = 4;
    private static final long serialVersionUID = -840134817432261960L;
    public ImageInfo gif_image_info;
    public int height;
    public String local_uri;
    public int type;
    public String uri;
    public String url;
    public List<UrlItem> url_list;
    public int width;
    public Image() {

    }

    protected Image(Parcel arg2) {
        this.url = arg2.readString();
        this.local_uri = arg2.readString();
        this.url_list = arg2.createTypedArrayList(UrlItem.CREATOR);
        this.uri = arg2.readString();
        this.height = arg2.readInt();
        this.width = arg2.readInt();
        this.type = arg2.readInt();
    }

    public Image(String arg3, int arg4) {
        this.url = null;
        this.local_uri = arg3;
        this.uri = null;
        this.url_list = null;
        this.height = 0;
        this.width = 0;
        this.type = arg4;
    }

    public int describeContents() {
        return 0;
    }

    public boolean isGif() {
        boolean v0 = this.type == 2 ? true : false;
        return v0;
    }

    public boolean isLocal() {
        boolean v0 = !TextUtils.isEmpty(this.local_uri) ? true : false;
        return v0;
    }

    public void writeToParcel(Parcel arg2, int arg3) {
        arg2.writeString(this.url);
        arg2.writeString(this.local_uri);
        arg2.writeTypedList(this.url_list);
        arg2.writeString(this.uri);
        arg2.writeInt(this.height);
        arg2.writeInt(this.width);
        arg2.writeInt(this.type);
    }

    public static class UrlItem implements Parcelable, Serializable {
        public static final Creator<UrlItem> CREATOR = new l();
        private static final long serialVersionUID = -5280086768898673942L;
        public String url;

        public UrlItem() {
        }

        protected UrlItem(Parcel parcel) {
            this.url = parcel.readString();
        }

        public int describeContents() {
            return 0;
        }

        public void writeToParcel(Parcel parcel, int i) {
            parcel.writeString(this.url);
        }
    }
}

